-
Notifications
You must be signed in to change notification settings - Fork 32
[FSSDK-11373] add holdout support and refactor decision logic in DefaultDecisionService #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc enhancement looks good. A few more suggestions for clean up.
let holdouts = config.getHoldoutForFlag(id: featureFlag.id) | ||
for holdout in holdouts { | ||
let dicisionResponse = getVariationForHoldout(config: config, | ||
flagKey: featureFlag.key, | ||
holdout: holdout, | ||
user: user) | ||
reasons.merge(dicisionResponse.reasons) | ||
if let variation = dicisionResponse.result { | ||
let featureDicision = FeatureDecision(experiment: holdout, variation: variation, source: Constants.DecisionSource.holdout.rawValue) | ||
return DecisionResponse(result: featureDicision, reasons: reasons) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this up to the upper level like - since it's more like for flag not flag experiments.
decide flag {
checkVariationForHoldout()
getVariationForFeatureExperiments()
getVariationForRollout()
}
|
||
func getVariationForFeatureExperiment(config: ProjectConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we rename it? This method evaluate only "experiments" part of a flag, so the original name may be more clear, differentiated from the other part getVariationForFeatureRollout
below?
- Parameter bucketingId: The ID to bucket. This must be a non-null, non-empty string. | ||
- Returns: The variation the bucketingId was bucketed into. | ||
*/ | ||
func bucketToVariation(experiment: ExperimentCore, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we adding new signature to this public protocol? This may break existing custom implementations on client side.
Summary
ExperimentCore
to replaceExperiment
in several methods across the codebase.DefaultDecisionService
for improved readability and holdout support.getVariationForHoldout
method to evaluate holdout conditions and bucket users into holdouts.OPTBucketer
protocol by adding the newbucketToVariation
method.BucketTests_HoldoutToVariation.swift
,DecisionServiceTests_Features_Holdouts.swift
,OptimizelyUserContextTests_Decide_Holdouts.swift
,OptimizelyUserContextTests_Decide_With_Holdouts_Reasons.swift
Test plan
Issues